Skip to content

Cap shard scale-up by indexing CPU capacity - #7007

Draft
fulmicoton-dd wants to merge 1 commit into
mainfrom
paul.masurel/cap-shard-scale-up-by-indexing-capacity
Draft

fulmicoton-dd wants to merge 1 commit into
mainfrom
paul.masurel/cap-shard-scale-up-by-indexing-capacity

Conversation

@fulmicoton-dd

Copy link
Copy Markdown
Collaborator

Problem

Under sudden load, the control plane keeps scaling up shards, and the indexing scheduler keeps creating pipelines for them. Past a point, this does not increase indexing throughput: indexers are saturated.

Change

Behind QW_ENABLE_INDEXING_CAPACITY_SHARD_CAP (off by default), the ingest controller clamps throughput-driven shard scale-up:

  • Pipeline budget = total CPU advertised by indexers / QW_CPU_MILLIS_PER_PIPELINE (default 1000, one pipeline per core).
  • Pipelines used = for each enabled source with shards, ceil(num_shards / max_shards_per_pipeline). Open and closed shards are counted. max_shards_per_pipeline uses the scheduler's load model.
  • A scale-up is clamped to the free slots in the source's last pipeline, plus max_shards_per_pipeline slots per pipeline left in the budget.

Scale-ups needed to reach min_shards, and the first shards of a source, are never clamped.

New gauge quickwit_control_plane_shard_scale_up_at_max_capacity: 1 when the last scale-up was clamped, 0 otherwise.

Docs: docs/internals/ingest-v2.md.

Notes

  • With the default load model, a shard is ~1 core and a pipeline holds 3 shards. One pipeline per core is therefore ~3x more permissive than the scheduler's model. Setting QW_CPU_MILLIS_PER_PIPELINE to ~3000–3200 matches it.
  • Non-sharded sources (Kafka, etc.) are not counted in the budget.
  • The gauge is cluster-wide, not per source.

Tests

  • Unit tests in ingest/indexing_capacity_cap.rs (budget, pipelines used, clamp).
  • New tests in ingest_controller.rs: end-to-end clamp through handle_local_shards_update, no clamping below min_shards, no clamping when the cap is disabled.
  • cargo nextest run -p quickwit-control-plane: 158 passed.

🤖 Generated with Claude Code

Under sudden load, the control plane keeps opening shards, and the
scheduler keeps creating pipelines for them, beyond what indexers can
process.

When `QW_ENABLE_INDEXING_CAPACITY_SHARD_CAP` is set, throughput-driven
shard scale-up is clamped so that the pipelines implied by all shards
do not exceed the CPU capacity advertised by indexers divided by
`QW_CPU_MILLIS_PER_PIPELINE` (default: 1000, one pipeline per core).
Shards per pipeline are computed with the scheduler's load model.

Scale-ups needed to reach `min_shards` and the first shards of a source
are never clamped. A new gauge `shard_scale_up_at_max_capacity` is set
to 1 when a scale-up gets clamped, and 0 otherwise.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant